<div id="bookmarklet">
	<div id="addForm">
		<% form_tag "", {:id => "bookmarklet_addpin_form"} do-%>
			<div class="imagePicker">
				<div class="images pin">
					<ul>
						<li><img alt="Media" src="<%= params[:media]%>"></li>
					</ul>
				</div>
			</div>
			<div class="pinForm">
				<div class="boardListOverlay" style="display: none;"></div>
				<div class="boardSelector boardPicker">
					<div class="current">
						<span class="currentBoard"><%= @boards[0].name%></span>
						<span class="downArrow"></span>
					</div>
					<div class="boardList" style="display:none;">
						<div class="wrapper">
							<ul>
								<%= show_boards(@boards)%>
							</ul>
                            <div class="createBoard">
                                <input type="text" placeholder="创建新画板">
                                <button class="button whiteButton button18 noFloat" type="button">创建</button>
                                <div class="createBoardStatus" style="display: none;">
                                </div>
                            </div>
						</div>
					</div>
				</div>
				<div class="inputArea">
					<ul class="form fancyForm">
	                    <li class="noMarginBottom val">
	                        <textarea class="descriptionTextarea" name="caption" rows="2" data-text-error-empty="Please enter a description."><%= params[:description]%></textarea>
							<label>描述您的采集…</label>
	                    </li>
					</ul>
				</div>
				<div class="createBoardStatus error mainerror"></div>
				<div class="buttons">
					<button class="button button18 whiteButton" type="button" data-text-pinning="采集…" data-text-pin-it="采集">采集</button>
				</div>
			</div>
			<%= hidden_field_tag "board_id", @boards[0].id%>
		<% end%>
	</div>
</div>
<script>
    $(document).ready(function(){
        $('.boardPicker').click(function(){
            $(".boardList").css('display', 'block')
            $(".boardListOverlay").css('display', 'block')
        });
        $('.boardListOverlay').click(function(){
            $(".boardList").css('display', 'none')
            $(".boardListOverlay").css('display', 'none')
        });
		FancyForm.setup();
        boardPicker.setup("#bookmarklet .boardPicker", function(value){
            $("#bookmarklet #board_id").val(value);
        }, function(value){
            $("#bookmarklet #board_id").val(value);
        });
		
        $("#bookmarklet .descriptionTextarea").focus();
        $("#bookmarklet .buttons .button").click(function(){
            var button = $(this);
            if (button.hasClass("disabled")) {
                return false;
            }
            if ($('.descriptionTextarea').val() == "") {
                $('.mainerror').html("请描述您的采集").slideDown(300);
                return false;
            }
            else {
                button.addClass("disabled").html(button.data('text-pinning'));
                $("#bookmarklet_addpin_form").submit();
                return false;
            }
        });
    });
</script>







